package com.example.yin.controller;


import com.example.yin.common.R;
import com.example.yin.mapper.SysLogMapper;
import com.example.yin.service.SysLogService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Aspect
@RestController
public class SysLogController {
    @Autowired
//    用于访问与系统日志相关的业务逻辑
    private SysLogService sysLogService;
//这是一个Spring AOP注解，表示在方法成功返回后执行指定的操作
    @AfterReturning(
            value = "execution(* com.example.yin.controller.ConsumerController.loginStatus(..))",
            returning = "result"
    )
//    用SysLogService对象的loginInfo方法来记录登录信息，并返回相应的结果
    public R SysLogInfo(JoinPoint jp,R result){
        return sysLogService.loginInfo(jp,result);
    }
    @GetMapping("/allLog")
//    获取所有系统日志
    public R getSysLog(){
        return sysLogService.allLog();
    }
}
